package udp;

import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class 接收端 {
    public static void main(String[] args) throws Exception{
        System.out.println("接收端开始运行了");
        byte[] data = new byte[1024];
        DatagramPacket packet = new DatagramPacket(data,0,data.length);
        DatagramSocket socket = new DatagramSocket(1024);
        socket.receive(packet);
        System.out.println(new String(data,0,packet.getLength()));

        socket.close();
    }
}
